<%-- 
    Document   : user-profile
    Created on : Feb 9, 2012, 8:37:14 AM
    Author     : PhucAn
--%>

<%@page import="util.SharingUtil"%>
<%@page import="util.DateTime"%>
<%@page import="dao.UserDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    UserDAO daoUser = new UserDAO();
    int id = 0;
    String uId = request.getParameter("id");
    if (uId != null) {
        id = Integer.parseInt(uId);
    } else {
        id = SharingUtil.getUser(session).getId();
    }
    dto.User user = daoUser.getUser(id);
    DateTime dt=new DateTime();

%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Profile</title>
        
        <script type="text/javascript">
            $(document).ready(function(){
                $('#dob').datepicker();
            });
        </script>
    </head>
    <body>        
        <table class="form-table">
            <tr>
                <td>First name: </td>
                <td><input type="text" name="firstname" value="<%=user.getFirstName()%>"/></td>
                <td></td>
            </tr>
            <tr>
                <td>Last name: </td>
                <td><input type="text" name="lastname" value="<%=user.getLastName()%>"/></td>
                <td></td>
            </tr>
            <tr>
                <td>Username: </td>
                <td><input type="text" name="username" value="<%=user.getUsername()%>"/></td>
                <td></td>
            </tr>
            <tr>
                <td>Gender: </td>
                <td><input type="radio" name="gender" value="male" <%=user.getGender() ? "checked='checked'" : ""%>/> Male - <input type="radio" name="gender" value="female" <%= !user.getGender() ? "checked='checked'" : ""%>/> Female</td>
                <td></td>
            </tr>
            <tr>
                <td>Date of birth:</td>
                <td><input type="text" name="dob" id="dob" value="<%=dt.getDateTimeAsString("MM/dd/yyyy") %>" /></td>
                <td></td>
            </tr><tr>
                <td>Email:</td>
                <td><input type="text" name="email" value="<%=user.getEmail()%>"/></td>
                <td></td>
            </tr>
            <tr>
                <td>Registered date:</td>
                <td><%=user.getRegisteredDate()%></td>
                <td></td>
            </tr>
            <tr>
                <td></td>
                <td><intput type="submit" name="submit" value="Save change"/></td>
        <td></td>
    </tr>


</table>
</body>
</html>
